#ifndef __TIMECORE_H__
#define __TIMECORE_H__

/* Include files. */
#include "standard.h"

/* Macro constant definitions. */

/* Type definitions. */

class timer 
{
public: 
	timer();
	void start();
	void stop();
	void reset();
	void costTime();
	
private:
	struct timeval _start;
	struct timeval _end;
	bool _b1,_b2;
};

class subSystem;
class timeObj 
{
public:
	timeObj()
	{
#ifdef U_LOOP
		memset(&_w, 0, sizeof(_w));
		_w.data = this;
#endif
	}
	~timeObj(){}
	
public:
#ifdef U_LOOP
	struct uloop_timeout _w;
#else
	ev_timer _w;
#endif 
	u32 _session;
	subSystem *_sub;
};

/* External variable declarations. */

/* External function declarations. */

/* Macro API definitions. */

int luaTimeout(lua_State *L);
int luaDeleteTime(lua_State *L);
int luaNewTimeObj(lua_State *L);
u64 currentMsTime(void); 

#endif


